home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 4
/
Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso
/
Communications
/
General
/
LineShare Folder
/
Put Onto Productions Disks
/
LineShare Scripts
/
Pro⁄Office Fax&ARA
< prev
next >
Wrap
Text File
|
1994-02-10
|
6KB
|
263 lines
! Version 2.1
!
!$ Use with: Prometheus HomeOffice 2400/9600 fax modems.
!$ Supports: fax (MaxFax) and ARA incoming calls.
!
!$ A cable for hardware handshaking is required
^2 Speaker On: = Enum("Never" = "0","During Connect" = "1", "Always"="2") "1"
^3 Speaker Volume: = Enum("Low"="1","Medium"="2","High"="3") "2"
^4 Answer On: = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
^5 Fax Identifier: = Text "Stalker_GmbH"
^6 Handshake wires: = Bool("CTS/RTS"="&D0\Q3","CTS only"="&D2\Q2") "&D2\Q2"
! ------------------------------------------
! Resetting the modem:
! ------------------------------------------
@Hangup
Note "Resetting" 3
SetTries 2
Flush
HsReset 0,0,17,19,0,0
!
! Try to catch the "OK" answer, use the Escape seq and DTR transitions
! to enter the command mode
!
@Label 1
matchclr
matchstr 1 2 "OK\r\n"
write "ATH0&F\r"
matchread 20
Write "+++"
DtrClear
pause 5
DtrSet
!
SerReset 19200,0,8,1
DecTries
IfTries 1 1
SerReset 9600,0,8,1
IfTries 0 1
!
! OSErr -6019 "Modem error - the modem is not responding"
!
exit -6019
@Label 2
SerReset 9600,0,8,1
write "AT+FCLASS=0\r"
Jsr 100
write "AT+FAA=0\r"
Jsr 100
exit 0
! ------------------------------------------
! Receiving incoming calls
! ------------------------------------------
@ANSWER
!
! Set the modem preferred speed first
!
SerReset 9600,0,8,1
Jsr 80
@Label 10
!
! Set the common options
Jsr 70
!
! Set the communication options:
! • \N0: Normal connection (for ARA)
! • W1: report connection speed
!
Write "AT\\N0W1\r"
Jsr 100
!
! Set Fax parameters: LID, DCC,BOR
!
Write "AT+FCLASS=2\r"
Jsr 100
! Nice feature: when in Class 2, the modem switches to 19200 always!
SetSpeed 19200
Write "AT+FLID=\"^5\"\r"
Jsr 100
Write "AT+FDCC=1,3,0,2,0,0,0,0\r"
Jsr 100
Write "AT+FCR=1\r"
Jsr 100
!
! Tell the modem to determine the type of the incoming call
! Fetch the tube after ^4 rings
!
Write "ATS0=^4+FAA=1\r"
Jsr 100
!
! Everything is ready - let's sit and wait for a call
! We'll wait for 2 minutes, then reinitiate the modem
!
Note "Waiting for a fax or ARA call…"
@Label 15
MatchClr
matchstr 1 16 "RING\r\n"
matchstr 2 20 "\r\nCARRIER "
matchstr 3 30 "\r\n+FCON"
matchstr 4 10 "\r\nNO "
matchstr 5 10 "\r\nBUSY"
Matchread 1200
jump 10
@Label 16
Note "Ring…"
jump 15
!
! Data connection has been established (we read "CARRIER")
! Put the "CONNECT" back to the buffer and attach the "Data" subPort
! if it was an incoming call, put the "RING" before the "CONNECT"
!
@Label 20
QueueInput "\r\nCARRIER "
ifOriginate 21
QueueInput "\r\nRING\r\n"
@Label 21
Attach "ARA" (DTR,Escape,TimeLimit=0)
!
! Fax connection has been established (we read "+FCON")
! Put the +FCON back to the buffer,
! if it was an incoming call, put the "RING" before the "+FCON"
! Attach the "Fax" subPort
!
@Label 30
QueueInput "\r\n+FCON"
ifOriginate 31
QueueInput "\r\nRING\r\n"
@Label 31
Note "Fax Port Attached" 3
Attach "Fax" (DTR,Escape,IdleLimit=30)
! ------------------------------------------
! Originating a call through the "ARA" subport
! ------------------------------------------
@ORIGINATE "ARA"
SerReset 9600,0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Set the Data mode:
! • \N0 Normal connection (no compression, correction - for ARA)
! • W1: report connection rate
!
Write "AT\\N0W1\r"
Jsr 100
!
! Prepare to receive all error result codes, dial the number
!
Jsr 90
MatchStr 1 20 "\r\nCARRIER "
MatchRead 1000
Write "\r"
Exit -6019
! ------------------------------------------
! Originating a call through the "Fax" subPort
! ------------------------------------------
@ORIGINATE "Fax" ("\r\nLineShare Line is Busy\r\nBUSY\r\n")
!
! Set the "Fax" speed
!
Note "Originating FAX" 3
SerReset 9600,0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Set the Fax mode
! \Q3: HW handshake
!
Write "AT+FCLASS=2\r"
Jsr 100
SetSpeed 19200
!
! Now emit all commands that the application has sent to that port,
!
EmitClear "+FCLASS"
Jsr 60
!
! Prepare to receive all error result codes, dial the number
!
Jsr 90
HSReset 0 1 0 0 0 0
MatchStr 1 30 "\r\n+FCON"
MatchRead 900
Write "\r"
Exit -6019
!
! This section emits all modem commands sent from the client application
! For each set of commands the "OK" answer is awaited
!
@Label 60
EmitStart
@Label 61
EmitCommand 62
Jsr 100
Jump 61
@Label 62
return
!
! This section initiates the modem before ANSWER and ORIGINATEs:
! extended responses + connect at the highest rate + speaker control +
! reset on Dtr drop
! Verbal responses mode, no echo
!
@Label 70
Write "ATX4M^2L^3^6V1E0\r"
Jsr 100
return
!
! This section syncronize the modem after the serial port speed switching
!
@Label 80
ChrDelay 1
Write "AT\r"
ChrDelay 0
Jsr 100
return
!
! Prepare to receive error result codes, send the dialing command and
! set the user's handshake mode
!
@Label 90
MatchClr
MatchStr 2 91 "NO DIALTONE\r\n"
MatchStr 3 92 "BUSY\r\n"
MatchStr 4 93 "NO CARRIER\r\n"
MatchStr 5 94 "NO ANSWER\r\n"
Write "ATD^1\r"
HsReset *
return
@Label 91
exit -6020
@Label 92
exit -6022
@Label 93
exit -6021
@Label 94
exit -6023
!
! Processing the AT command:
! OK -> proceed
! ERROR or TimeOut ->exit -6019
! It can be called AFTER the "Write" command, since LineShare buffers input
!
@Label 100
MatchClr
MatchStr 1 102 "\r\nOK\r\n"
MatchStr 2 101 "\r\nERROR\r\n"
MatchRead 20
@Label 101
Exit -6019
@Label 102
return